#ifndef CTSOCKETRUNNABLE_H
#define CTSOCKETRUNNABLE_H

//#include <QRunnable>
//#include <QObject>
#include "ctclientsocket.h"
#include "publicstruct.h"
//#include "memory"

class CTSocketRunnable : public QObject,public QRunnable
{
    Q_OBJECT
public:

    CTSocketRunnable(QMap<QString, DomainQryAddrInfo> dqai);
    CTSocketRunnable(QVector<SocketDnInfo> dnVects);
    ~CTSocketRunnable();
    void run() override;
    QMap<QString,DomainQryAddrInfo> m_dnMaps;
    QVector<SocketDnInfo> m_dnVects;
signals:
    void resultReady(const QByteArray data, const QString requestParam);
private slots:
    void dataReceivedFromSocket(const QByteArray data, const QString requestParam);

private:
    //CTClientSocket *m_clientSocket;
    QString m_requestId;

    std::vector<std::unique_ptr <CTClientSocket>> m_clientSockets; // 新增成员变量
    void startClientSockets();
    void stopClientSockets();
};

#endif // CTSOCKETRUNNABLE_H
